import { TransactionType, PaymentMethod, TransactionStatus } from '@/types/finance';

export const getTransactionType = (type: TransactionType) => {
  const map: Record<TransactionType, { text: string; color: 'success' | 'error' | 'warning' }> = {
    [TransactionType.Income]: { text: '收入', color: 'success' },
    [TransactionType.Expense]: { text: '支出', color: 'error' },
    [TransactionType.Refund]: { text: '退款', color: 'warning' },
  };
  return map[type] || { text: '未知', color: 'warning' };
};

export const getPaymentMethod = (method: PaymentMethod) => {
  const map: Record<PaymentMethod, string> = {
    [PaymentMethod.WeChat]: '微信支付',
    [PaymentMethod.Alipay]: '支付宝',
    [PaymentMethod.Balance]: '余额支付',
    [PaymentMethod.Offline]: '线下支付',
  };
  return map[method] || '未知';
};

export const getTransactionStatus = (status: TransactionStatus) => {
  const map: Record<TransactionStatus, { text: string; type: 'success' | 'warning' | 'error' }> = {
    [TransactionStatus.Completed]: { text: '已完成', type: 'success' },
    [TransactionStatus.Pending]: { text: '处理中', type: 'warning' },
    [TransactionStatus.Failed]: { text: '失败', type: 'error' },
  };
  return map[status] || { text: '未知', type: 'warning' };
};